﻿using System.Security.Cryptography;
using System.Text;

namespace 加密算法
{
    public class MD5Helper
    {
        /// <summary>
        /// 获取MD5(内置类库实现)
        /// </summary>
        /// <param name="str"></param>
        /// <returns></returns>
        public static string GetMD5(string str)
        { 
            return MD5.Create().ComputeHash(Encoding.UTF8.GetBytes(str)).Aggregate("", (current, t) => current + t.ToString("X2"));
        }
    }
}
